//
//  BarberDetailsViewController.m
//  afn
//
//  Created by mac on 2018/5/8.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "BarberDetailsViewController.h"
#import "BarberDetailsView.h"
@interface BarberDetailsViewController ()
@property(nonatomic,strong)BarberDetailsView *aView;

@end

@implementation BarberDetailsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"发型师介绍";
    _aView=[BarberDetailsView new];
    [self.view addSubview:_aView];
    [_aView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
        make.top.mas_equalTo(NAV_HEIGHT);
    }];
    [_aView creatView];
    _aView.viewController=self;
    [self getTableData];
}
-(void)getTableData{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSDictionary *dingWeiDic = [defaults objectForKey:@"dingWei"];
    NSDictionary *dic;
    if (dingWeiDic) {
        dic=[NSDictionary dictionaryWithObjectsAndKeys:[dingWeiDic objectForKey:@"longitude"],@"lng",[dingWeiDic objectForKey:@"latitude"],@"lat",_barber_id,@"barber_id", nil];
    }else{
        dic=[NSDictionary dictionaryWithObjectsAndKeys:@"page",@"0",@"lng",@"0",@"lat",_barber_id,@"barber_id", nil];
    }
    
    [gongju AFNPOSTDataUrl:@"v1/barber/barber-info" andDic:dic andTableView:nil andViewController:self andSuccessBlock:^(id responseObject) {
        [self->_aView.tableView.mj_footer endRefreshing];
        [self->_aView.tableView.mj_header endRefreshing];
        self->_aView.model=[BarberDetailsModel mj_objectWithKeyValues:responseObject];
        [self.aView.tableView reloadData];
    } anderrorBlock:nil];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
